# 7-5 汉诺塔求解【函数】



def hrt(a,b,c,n):
    if n==1:
        print("[STEP{:>4}] {}->{}".format(hrt.counter,a,c))
        hrt.counter+=1
    else:
        hrt(a,c,b,n-1)
        print("[STEP{:>4}] {}->{}".format(hrt.counter,a,c))
        hrt.counter += 1
        hrt(b,a,c,n-1)
# 初始化步骤计数器
hrt.counter=1
# 输入
n= int(input())

hrt("A","B","C",n)
